﻿using Dapper;
using System;
using BCEntity.Common.DictionaryCategory;
using System.Collections.Generic;
using System.Data;
using System.Text;
using System.Threading.Tasks;
using BCCommon.Enums;

namespace BCData.Common.DictionaryCategory
{
    /// <summary>
    /// 字典分类
    /// </summary>
    public interface IDictionaryCategoryData
    {
        #region  成员方法
        /// <summary>
        /// 是否存在该记录
        /// </summary>
        /// <param name="dictionaryCategoryId">字典分类Id</param>
        Task<bool> Exists(long dictionaryCategoryId);
        /// <summary>
        /// 是否存在该记录
        /// </summary>
        /// <param name="categoryCode">分类编码</param>
        Task<bool> Exists(string categoryCode);
        /// <summary>
        /// 增加字典分类
        /// </summary>
        /// <param name="entity">字典分类信息</param>
        Task<DictionaryCategoryEntity> Add(DictionaryCategoryEntity entity);
        /// <summary>
        /// 更新字典分类
        /// </summary>
        /// <param name="entity">字典分类信息</param>
        Task<DictionaryCategoryEntity> Update(DictionaryCategoryEntity entity);
        /// <summary>
        /// 更新树形码
        /// </summary>
        /// <param name="dictionaryCategoryId">字典分类Id</param>
        /// <param name="treeCode">树形码</param>
        /// <returns></returns>
        Task<DictionaryCategoryEntity> UpdateTreeCode(long dictionaryCategoryId,string treeCode);
        /// <summary>
        /// 删除字典分类
        /// </summary>
        /// <param name="dictionaryCategoryId">字典分类Id</param>
        Task<bool> Delete(long dictionaryCategoryId);
        /// <summary>
        /// 获取字典分类
        /// </summary>
        /// <param name="dictionaryCategoryId">字典分类Id</param>
        Task<DictionaryCategoryEntity> GetEntity(long dictionaryCategoryId);
        /// <summary>
        /// 获取字典分类列表
        /// </summary>
        /// <param name="parentCategoryId">父级分类Id</param>
        Task<IEnumerable<DictionaryCategoryEntity>> GetList(long? parentCategoryId);
        /// <summary>
        /// 获取字典分类列表
        /// </summary>
        /// <param name="systemType">系统类型</param>
        /// <returns></returns>
        Task<IEnumerable<DictionaryCategoryEntity>> GetList(BCSystemType systemType);
        /// <summary>
        /// 获取字典分类分页列表
        /// </summary>
        /// <param name="start">开始时间</param>
        /// <param name="end">结束时间</param>
        /// <param name="sortName">排序字段</param>
        /// <param name="ascending">升序</param>
        /// <param name="pageIndex">当前页码</param>
        /// <param name="pageSize">每页数据条数</param>
        Task<(IEnumerable<DictionaryCategoryEntity>, int)> Query(DateTime? start, DateTime? end, string sortName, bool? ascending, int pageIndex, int pageSize);
        #endregion  成员方法
    }


}